package cn.hd01.repository;

import javax.transaction.Transactional;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import cn.hd01.repository.entity.HotRecommend;

@Repository
public interface HotRecommendRepository extends JpaRepository<HotRecommend, Integer> {
	
	Page<HotRecommend> findAll(Specification<HotRecommend> spec, Pageable pageable);
	
	Page<HotRecommend> findAll(Specification<HotRecommend> spec);
	
	
	@Modifying
	@Transactional
	@Query(value = "update HotRecommend set name =?1,url=?2, image = ?3, update_time = now() where id=?4")
	int updateHotRecommend(String name, String url, String image,Integer id);
	
}
